import { Component, OnInit } from '@angular/core';
import { MessageService } from 'src/app/core/service/message.service';
import { ApiService } from 'src/app/core/api';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
    templateUrl: './myProject.html',
    styleUrls: ['./myProject.scss']
})
export class MyProjectComponent implements OnInit {
    list = [{
        "id": 1,
        "title": "安全防范高清视频监控系统技术要求",
        v: 61,
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }, {
        "id": 1,
        v: 60,
        "title": "安全防范系统",
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }, {
        v: 57,
        "id": 1,
        "title": "单位（楼宇）",
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }, {
        v: 56,
        "id": 1,
        "title": "高安全楼寓对讲系统",
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }, {
        v: 52,
        "id": 1,
        "title": "城市轨道交通安全防范系统",
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }, {
        v: 49,
        "id": 1,
        "title": "电力设施",
        "content": "内容",
        'name': '公安三所',
        "createTime": "2019-12-05 14:53:05",
        "editTime": null,
        'img': '../../../../assets/img/home-page/cmr01.jpg'
    }];
    statusDatas = [{
        v: 1,
        name: '委托检测'
    }, {
        v: 2,
        name: '型式检测'
    }, {
        v: 3,
        name: '远程检测'
    }]
    page = {
        cateId: 3,
        pageNo: 1,
        porjacts: [],
        array: [
            '../../../../assets/img/home-page/banner1.png',
            '../../../../assets/img/home-page/banner2.png',
            '../../../../assets/img/home-page/banner3.png'
        ],
        hots: [
            {
                titel: '安全防范高清视频监控系统技术要求',
                types: ['检测标准', '依赖仪器', '现场评估'],
                v: 6,
                img: '../../../../assets/img/home-page/cmr01.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
            {
                titel: '广播',
                types: ['检测标准', '依赖仪器', '现场评估'],
                img: '../../../../assets/img/home-page/cmr02.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
            {
                titel: '网络摄像机检测',
                types: ['检测标准', '依赖仪器', '现场评估'],
                img: '../../../../assets/img/home-page/cmr03.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
            {
                titel: '网络摄像机检测',
                types: ['检测标准', '依赖仪器', '现场评估'],
                img: '../../../../assets/img/home-page/cmr04.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
            {
                titel: '网络摄像机检测',
                types: ['检测标准', '依赖仪器', '现场评估'],
                img: '../../../../assets/img/home-page/cmr05.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
            {
                titel: '网络摄像机检测',
                types: ['检测标准', '依赖仪器', '现场评估'],
                img: '../../../../assets/img/home-page/cmr06.jpg',
                jg: '3.2万',
                beforjg: '4.16万'
            },
        ]
    };
    sharchTags = [];

    ngOnInit() {
        this.message.setBreadcrumb({
            breadcrumbs: [
                { name: '我要检测' }
            ]
        });
        this.getSearchData();
    }

    getList(data) {
        this.api.post('我要检测列表', {
            "pageNo": "1",
            "testType": "T1"
        }).then((res: any) => {
            console.log('banner', res)
            this.page.porjacts = res.data.list;
            this.page.pageNo = res.data.pageNo;
        }).catch((res) => {
            this.msg.error(res.message);
        });
    }

    getSearchData() {
        this.api.post('热门监测列表', this.page).then((res: any) => {
            this.page.hots = res.data.list;

        })
    }

    handleChange(item) {
        // this.page.vulnerabilityTypeId = item.id;
        // for (let i = 0; i < this.sharchTags.length; i++) {
        //     this.sharchTags[i].isSel = item == this.sharchTags[i] ? true : false;
        // }
        // this.getList( this.page )
    }
    constructor(
        private message: MessageService,
        private msg: NzMessageService,
        private api: ApiService
    ) { }
}